// AC B站
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e7 + 5;
bool nprime[N], vis[N];
int main() {
  ll L, R, ans = 0;
  scanf("%lld %lld", &L, &R);

  // i*i<=R为啥不可以？
  for (ll i = 2; i < N; i++) {
    if (nprime[i])
      continue;

    for (ll j = (L / i + 1) * i; j <= R; j += i) {
      vis[j - L] = true; // 偏移量L

      // 判断j是否是i^?
      ll cur = j;
      while (cur % i == 0)
        cur /= i;
      ans += (cur == 1);
    }

    // 标记所有i的倍数
    for (ll j = i * i; j < N; j += i) {
      nprime[j] = true;
    }
  }
  /*
    for (int i = 2; i * i <= R; i++) {
      if (!nprime[i]) {
        cout << i << " ";
      }
    } */

  // 判断 【L+1,R】质数的个数

  for (ll i = L; i <= R; i++)
    ans += !vis[i - L];

  printf("%lld\n", ans);
  return 0;
}
